package com.iamk.tool;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;

import com.iamk.feature.FColor;

public class OriganizationAlbum extends JPanel implements ActionListener{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	JButton btnOpenFolder;
	JButton btnOriganization;
	
	JLabel lblPath;
	JLabel picImageRetrieval;
	
	JTextField tfPath;
	
	JList<String> lsFileName;
	
	JScrollPane similarImagePane;
	JPanel mPanelImageRetrieval;
	JPanel mPanelImageResult;
	JPanel mPanelFileName;
	JScrollPane scrollFileName;
	
	JFileChooser dlgChooseFolder;
	
	Image imgRetrieval;
	FColor fImage;
	
	String path;
	
	public OriganizationAlbum() {
		super(null);
		setPropertiesComponent();
	}
	
	
	void setPropertiesComponent() {
		// Init view
		lblPath = new JLabel("Path: ");
		lblPath.setSize(new Dimension(50, 20));
		lblPath.setLocation(500, 20);

		btnOpenFolder = new JButton("Open");
		btnOpenFolder.setSize(new Dimension(70, 30));
		btnOpenFolder.setLocation(1020, 20);
		btnOpenFolder.setActionCommand("Open");
		btnOpenFolder.setVisible(true);
		btnOpenFolder.addActionListener(this);
		
		btnOriganization = new JButton("Origanization");
		btnOriganization.setSize(new Dimension(120, 30));
		btnOriganization.setLocation(1100, 20);
		btnOriganization.setActionCommand("Origanization");
		btnOriganization.setVisible(true);
		btnOriganization.addActionListener(this);
		
		tfPath = new JTextField();
		tfPath.setSize(470, 30);
		tfPath.setMargin(new Insets(3, 3, 3, 3));
		tfPath.setLocation(540, 20);
		// Panel File Input
		mPanelFileName = new JPanel(new BorderLayout());
		mPanelFileName.setBorder(BorderFactory.createTitledBorder("File name"));
		mPanelFileName.setSize(new Dimension(400, 300));
		mPanelFileName.setLocation(30, 20);

		lsFileName = new JList<String>();
		lsFileName.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		scrollFileName = new JScrollPane(lsFileName,
				ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
				ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		mPanelFileName.add(scrollFileName);
		
		// Panel Result
		mPanelImageResult = new JPanel(new BorderLayout());
		mPanelImageResult.setBorder(BorderFactory.createTitledBorder("Similar Image Result"));
		mPanelImageResult.setSize(new Dimension(1220, 600));
		mPanelImageResult.setLocation(30, 350);

//		txtResult = new JTextArea();
//		similarImagePane = new JScrollPane(txtResult,
//				ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
//				ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
//		mPanelImageResult.add(similarImagePane);
		
		this.add(lblPath);
		this.add(tfPath);
		this.add(btnOpenFolder);
		this.add(btnOriganization);
		this.add(mPanelFileName);
		this.add(mPanelImageResult);
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		
	}

}
